//
//  UIFont+MAAdv.h
//  MateAdv
//
//  Created by 茶 on 2023/9/8.
//

#import <UIKit/UIKit.h>
#import "MAUIModule.h"

NS_ASSUME_NONNULL_BEGIN

static inline UIFont* MAFontName(NSString *fontName, CGFloat size, BOOL scale){
    size = scale ? MARatioWidth(size) : size;
    UIFont *font = [UIFont fontWithName:fontName size:size];
    if (!font) {
        font = [UIFont systemFontOfSize:size];
    }
    return font;
}

static inline UIFont* MAFontScaleLight(CGFloat size){
    return MAFontName(@"PingFangSC-Light", size, YES);
}

static inline UIFont* MAFontScaleRegular(CGFloat size){
    return MAFontName(@"PingFangSC-Regular", size, YES);
}

static inline UIFont* MAFontScaleMedium(CGFloat size){
    return MAFontName(@"PingFangSC-Medium", size, YES);
}

static inline UIFont* MAFontScaleSemibold(CGFloat size){
    return MAFontName(@"PingFangSC-Semibold", size, YES);
}


static inline UIFont* MAFontLight(CGFloat size){
    return MAFontName(@"PingFangSC-Light", size, NO);
}

static inline UIFont* MAFontRegular(CGFloat size){
    return MAFontName(@"PingFangSC-Regular", size, NO);
}

static inline UIFont* MAFontMedium(CGFloat size){
    return MAFontName(@"PingFangSC-Medium", size, NO);
}

static inline UIFont* MAFontSemibold(CGFloat size){
    return MAFontName(@"PingFangSC-Semibold", size, NO);
}

@interface UIFont (MAAdv)

@end

NS_ASSUME_NONNULL_END
